<template>
  <div class="box">
    <div>
      <eagle-tab-page-list
        ref="pageTabList"
        url="/WhInvestigationReportLog/GetPageData"
        :params="params"
        placeholder="请输入事故名称搜索"
        @initActive="_initActive"
        @initList="_initList"
      >
        <div v-if="this.active === 0">
          <eagle-cell
            style="margin-top: 10px"
            class="card"
            v-for="(item, index) in list"
            :key="index"
          >
            <div>
              <div>
                <eagle-row
                  gutter="15"
                  style="word-break:break-all"
                >
                  <eagle-col>
                    <b style="font-size: 13px">{{ item.Contents }}</b>
                  </eagle-col>
                </eagle-row>
                <eagle-row
                  gutter="15"
                  style="word-break:break-all"
                >
                  <eagle-col>
                    <img
                      class="icon"
                      src="@/assets/Images/AppIcon/icon_list_type.png"
                    />事故名称：{{ item.AccidentName }}
                  </eagle-col>
                </eagle-row>

                <eagle-row gutter="20">
                  <eagle-col>
                    <img
                      class="icon"
                      src="@/assets/Images/AppIcon/icon_list_user.png"
                    />责任人：{{ item.RectificationPeople }}
                  </eagle-col>
                </eagle-row>
                <eagle-row gutter="20">
                  <eagle-col>
                    <img
                      class="icon"
                      src="@/assets/Images/AppIcon/icon_list_date.png"
                    />完成日期：{{ item.FinishDate | formatDate }}
                  </eagle-col>
                </eagle-row>

                <van-divider />
              </div>
              <div class="op_btn">
                <div
                  class="btn_item"
                  @click="view(item)"
                >
                  <img
                    src="@/assets/Images/AppIcon/icon_list_edit.png"
                    alt=""
                  />
                  <div class="mr-10">详情</div>
                </div>
              </div>
            </div>
          </eagle-cell>
        </div>
        <div v-if="this.active === 1">
          <eagle-cell
            style="margin-top: 10px"
            class="card"
            v-for="(item, index) in list"
            :key="index"
          >
            <div>
              <div>
                <!-- <b style="font-size: 13px">{{ item.AccidentName }}</b> -->
                <eagle-row
                  gutter="15"
                  style="word-break:break-all"
                >
                  <eagle-col>
                    <b style="font-size: 13px">{{ item.Contents }}</b>
                  </eagle-col>
                </eagle-row>
                <eagle-row
                  gutter="15"
                  style="word-break:break-all"
                >
                  <eagle-col>
                    <img
                      class="icon"
                      src="@/assets/Images/AppIcon/icon_list_type.png"
                    />事故名称：{{ item.AccidentName }}
                  </eagle-col>
                </eagle-row>
                <!-- <eagle-row gutter="15">
                                    <eagle-col>
                                        <img class="icon" src="@/assets/Images/AppIcon/icon_list_type.png" />整改行动:{{ item.Contents }}
                                    </eagle-col>
                                </eagle-row> -->
                <eagle-row gutter="20">
                  <eagle-col>
                    <img
                      class="icon"
                      src="@/assets/Images/AppIcon/icon_list_user.png"
                    />责任人：{{ item.RectificationPeople }}
                  </eagle-col>
                </eagle-row>
                <eagle-row gutter="20">
                  <eagle-col>
                    <img
                      class="icon"
                      src="@/assets/Images/AppIcon/icon_list_date.png"
                    />完成日期：{{ item.FinishDate | formatDate }}
                  </eagle-col>
                </eagle-row>
                <eagle-row gutter="15">
                  <eagle-col>
                    <img
                      class="icon"
                      src="@/assets/Images/AppIcon/icon_list_type.png"
                    />状态：{{ getStatus(item.Status) }}
                  </eagle-col>
                </eagle-row>

                <van-divider />
              </div>
              <div class="op_btn">
                <div
                  class="btn_item"
                  @click="view2(item)"
                >
                  <img
                    src="@/assets/Images/AppIcon/icon_list_edit.png"
                    alt=""
                  />
                  <div class="mr-10">详情</div>
                </div>
              </div>
            </div>
          </eagle-cell>
        </div>
      </eagle-tab-page-list>

    </div>
  </div>
</template>
<script>
import DialogPageList from "@/components/DialogPageList.vue";
import PageTabList from "@/components/PageTabList/PageTabList.vue";
export default {
  components: {
    PageTabList,
    DialogPageList,
  },
  data() {
    return {
      value: "",
      list: [],
      isEdit: false,
      active: 0,
      params: [
        {
          title: "待整改",
          dataType: "RectificationMeasures",
        },
        {
          title: "已整改",
          dataType: "HasTheRectification",
        },
      ],
      listUser: [],
    };
  },
  created() {},
  methods: {
    _initActive(active) {
      this.active = active;
    },
    _initList(list) {
      this.list = list;
    },
    view(item) {
      this.$router.push({
        path: "/whInvestigationReportLogRMBrowseDetail",
        query: { id: item.ID, state: "RectificationMeasures" },
      });
    },
    view2(item) {
      this.$router.push({
        path: "/whInvestigationReportLogRMBrowseDetail",
        query: { id: item.ID },
      });
    },
    _initListUser(list) {
      this.listUser = list;
    },
    getStatus(val) {
      if (val == 50) {
        return "未验收";
      } else if (val == 100) {
        return "已验收";
      }
    },
  },
};
</script>
<style lang="less" scoped>
.phone {
  position: relative;
  .code {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 12px;
  }
}
.register-info {
  background-color: #e8f1f8;
  padding-bottom: 20px;
}
.img-box {
  height: 50px;
  width: 50px;
  padding: 10px;
  position: absolute;
  left: 50%;
  top: 60px;
  background-color: #fff;
  border-radius: 50%;
  overflow: hidden;
}
.popup-title {
  line-height: 35px;
  padding: 10px;
  font-size: 15px;
  padding-left: 20px;
}

.op_btn {
  display: flex;
  justify-content: flex-end;
  .btn_item {
    display: flex;
    align-items: center;
    img {
      height: 15px;
      width: 15px;
      margin-right: 5px;
    }
  }
}
</style>